from typing import List, Dict
from shared.graph_client import GraphClient

class FolderScanner:
    def __init__(self, graph_client: GraphClient):
        self.client = graph_client
        
    def scan_mailbox_folders(self, user_id: str) -> List[Dict]:
        """扫描用户邮箱文件夹结构"""
        return list(self.client.paginate(f"users/{user_id}/mailFolders?includeHiddenFolders=true"))
    
    def get_folder_properties(self, user_id: str, folder_id: str) -> Dict:
        """获取文件夹元数据"""
        return self.client.make_request(
            "GET",
            f"users/{user_id}/mailFolders/{folder_id}?$select=id,displayName,childFolderCount,unreadItemCount"
        )
    
    def get_public_folder_tree(self) -> Dict:
        """获取公共文件夹树形结构"""
        return self.client.make_request("GET", "sites/root/drive/root/children")